//
// Created by 33145 on 2023/6/2.
//

#ifndef ROCKET_FDEVENT_GROUP_H
#define ROCKET_FDEVENT_GROUP_H

#include <vector>
#include <memory>
#include "../common/mutex.h"
#include "fdevent.h"

namespace rocket {

  class FdEventGroup {
  public:
    typedef std::shared_ptr<FdEventGroup> ptr;
    explicit FdEventGroup(int size);

    ~FdEventGroup() = default;
    FdEvent::ptr getFdEvent(int fd);

  public:
    static FdEventGroup::ptr GetFdEventGroup();

  private:
    int _size {0};
    std::vector<FdEvent::ptr> _fd_group;
    Mutex _mutex;

  };

}

#endif //ROCKET_FDEVENT_GROUP_H
